﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using DAL;
using DTO;
namespace BUS
{
   public class ADMINBUS
    {
        public static void Insert(ADMIN Username)
        {
            ADMINDAL l = new ADMINDAL();
            l.Insert(Username);

        }
        public static void Update(ADMIN Username)
        {
            ADMINDAL l = new ADMINDAL();
            l.Update(Username);
        }
        public static void Delete(int Ma)
        {
            ADMINDAL l = new ADMINDAL();
            l.Delete(Ma);
        }
        public static int CheckExist(int id)
        {
            int t = 0;
            ADMINDAL ad = new ADMINDAL();
            return id;
        }
        public static AdminColection GET(string Where, int PageIndex, int PageSize,string OrderBy, string OrderDirection, int TotalRecords)
        {
            ADMINDAL adDAL = new ADMINDAL();
            return adDAL.GET(Where, PageIndex, PageSize, OrderBy, OrderDirection, out TotalRecords);
        }

        public static ADMIN GetByID(int ma)
        {
            int t = 0;
            ADMINDAL adDAL = new ADMINDAL();
            AdminColection adcl = adDAL.GET("where " + AdminColumns.MA_AD.ToString() + " = " + ma.ToString(), 0, 0,
               AdminColumns.MA_AD.ToString(), "ASC", out t);
            if (adcl.Count == 1)
                return adcl[0];
            return null;
        }

     

        public static AdminColection GetAll()
        {
            int t = 0;
            ADMINDAL adDAL = new ADMINDAL();
            return adDAL.GET("where 1=1", 0, 10, AdminColumns.USER_NAME.ToString(), "ASC", out t);
        }
    }
}
